import { Injectable } from '@angular/core';
import { LoggerService } from "./logger.service";

@Injectable()
export class ProductService {

  constructor(private logger:LoggerService) { }

  getProduct(): Product {
    this.logger.log("这是其他服务的一个方法，通过constructor的传参，才初始化组件时调用的。")
    return new Product(66, "iphone8", 8888, "听说你从不生产手机？");
  }

}

export class Product {
  constructor(
    public id: number,
    public title: string,
    public price: number,
    public desc: string
  ) {

  }
}
